
'''Data object to avoid copy all attributes between CPU and PCB'''
class Context(object):

    def __init__(self, memory_block):        
        self.__memory_block = memory_block
        self.__program_counter = memory_block.start
        self.__params = []
        self.__vars = {}
        self.__pcb = None

    def set(self, key, value):
        self.__vars[key] = value
        
    def get(self, key):
        """TODO raise custom exception"""
        return self.__vars[key]
    
    def finished(self):
        return self.__program_counter == self.__memory_block.end
    
    @property
    def program_counter(self):
        return self.__program_counter
        
    @program_counter.setter
    def program_counter(self, program_counter):
        self.__program_counter = program_counter
        
    @property
    def pcb(self):
        return self.__pcb
        
    @pcb.setter
    def pcb(self, pcb):
        self.__pcb = pcb
    
    